import { roleTypes } from "../../../constants/enums";

export const reducer = (state, action) => {
  if (action.type === "roleAssignment") {
    let obj = {
      ...state,
      ...action.payload,
    };
    return obj;
  } else if (action.type === "userManagement") {
    let obj = {
      ...state,
      ...action.payload,
    };
    return obj;
  } else {
    return {
      ...state,
      page: "Grid",
      roleType: roleTypes.CORPORATE,
      searchString: "",
      userSearchString: "",
      filterString: "Active",
      filterLockedString: "All",
      pageAction: "",
      franchiseeId: "",
      shouldGetData: true,
      shouldGetCorpData: true,
      shouldGetFzData: true,
      shouldGetFranchiseeList: true,
    };
  }
};

export default reducer;
